package org.jeecg.modules.business.doc.outbound.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.business.doc.outbound.entity.WmsOutReceipt;
import org.jeecg.modules.business.doc.outbound.entity.WmsOutReceiptMaterial;
import org.jeecg.modules.business.doc.outbound.entity.dto.ListByOutboundIdResponseVO;
import org.jeecg.modules.business.doc.outbound.entity.vo.*;
import org.jeecg.modules.business.doc.outbound.vo.WmsOutReceiptMaterialResponseVO;

import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @Description: 出库单
 * @Author: jeecg-boot
 * @Date: 2023-08-09
 * @Version: V1.0
 */
public interface IWmsOutReceiptService extends IService<WmsOutReceipt> {

    /**
     * 添加一对多
     *
     * @param wmsOutReceipt
     * @param wmsOutReceiptMaterialList
     */
    public String saveMain(WmsOutReceipt wmsOutReceipt, List<WmsOutReceiptMaterial> wmsOutReceiptMaterialList, boolean checkStock);

    /**
     * 修改一对多
     *
     * @param wmsOutReceipt
     * @param wmsOutReceiptMaterialList
     */
    public void updateMain(WmsOutReceipt wmsOutReceipt, List<WmsOutReceiptMaterial> wmsOutReceiptMaterialList, boolean checkStock);

    /**
     * 删除一对多
     *
     * @param id
     */
    public void delMain(String id);

    /**
     * 批量删除一对多
     *
     * @param idList
     */
    public void delBatchMain(Collection<? extends Serializable> idList);

    /**
     * 通过出库任务id查询出库任务物料对应出库单物料相同字段
     *
     * @param id
     * @return
     */
    List<ListByOutboundIdResponseVO> listByOutboundTaskId(String id);

    /**
     * 出库单提交
     *
     * @param id
     * @param req
     */
    void commit(String id,
                HttpServletRequest req);

    /**
     * 出库单下查
     *
     * @param wmsOutReceiptTaskId
     * @return
     */
    List<WmsOutReceipt> listWmsOutReceipt(String wmsOutReceiptTaskId);

    IPage<WmsOutReceiptPageVO> listByPage(Page<WmsOutReceipt> page, WmsOutReceiptQueryVO wmsOutReceipt);


    /**
     * 补单-查询所有未创建出库单的物料信息
     * @param unCreateReqVO
     * @return
     */
    List<UnCreateOutVO> listAllUnCreate(UnCreateReqVO unCreateReqVO);

    /**
     * 补单-查询出库单需要的物料信息
     * @param materialIdList
     * @return
     */
    List<WmsOutReceiptMaterialResponseVO> getUnCreateMaterials(List<String> materialIdList);

    /**
     * 补单-新增物料
     * @param unCreateAddVO
     */
    @Deprecated
    void addReceiptMaterial(UnCreateAddVO unCreateAddVO);


    /**
     * 根据任务id获取出库单物料id
     * @param taskId
     * @return
     */
    List<WmsOutReceiptMaterial> getReceiptMaterialByTaskId(String taskId);

    /**
     * 盘亏单过账
     * @param id
     */
    Result<Void> pkdPassSAP(String id);
}
